home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 1999 #1 / Amiga Plus 1999 #1.iso / System-Boost / Workbench / BackClock / sources / notify.c < prev    next >
C/C++ Source or Header  |  1998-08-10  |  1KB  |  47 lines

  1. /*****************************************************************************
  2.  * 
  3.  * name                    : notify.c
  4.  * description            : handle the notify intuition library
  5.  * version                : 1.2
  6.  *
  7.  * created                : ?
  8.  * last change            : 9-3-98
  9.  *
  10.  *****************************************************************************
  11.  */
  12. #include <libraries/notifyintuition.h>
  13. #include <exec/memory.h>
  14.  
  15. #include <proto/exec.h>
  16. #include <string.h>
  17. #include <stdio.h>
  18. #include "utils.h"
  19.  
  20.  
  21. #define SCREEN "Workbench#?"
  22.  
  23. int startNotify(idWin * prj) {
  24.   /* initialise notification
  25.    */
  26.   int ret = FALSE ;
  27.   if ((prj->Notify->inr_Name  = AllocVec(sizeof(SCREEN), MEMF_PUBLIC)) != NULL) {
  28.     if ((prj->notifyPort      = CreateMsgPort()) != NULL) {
  29.       strcpy(prj->Notify->inr_Name, SCREEN) ;
  30.       prj->Notify->inr_Flags         = INRF_SEND_MESSAGE|INRF_WAIT_REPLY|INRF_BEFORE_CLOSEWORKBENCH|INRF_AFTER_OPENWORKBENCH ;
  31.       prj->Notify->inr_stuff.inr_Msg.inr_Port          = prj->notifyPort ;
  32.       prj->Notify->inr_Pri           = 101 ;
  33.       prj->Notify->inr_UniqueID      = 'MYCL' ;
  34.       NotIStartNotify(prj->Notify) ;
  35.       ret = TRUE ;
  36.     }
  37.   }
  38.   return(ret) ;
  39. }
  40.  
  41. void endNotify(idWin * prj) {
  42.   /* terminate notifiaction
  43.    */
  44.   if (prj->Notify)           NotIEndNotify(prj->Notify) ;
  45.   if (prj->notifyPort)       DeleteMsgPort(prj->notifyPort) ; 
  46.   if (prj->Notify->inr_Name) FreeVec(prj->Notify->inr_Name) ;
  47. }